javascript created input[type="text'] doesn't post it's variable

Posted by ivannovak on Stack Overflow See other posts from Stack Overflow or by ivannovak
Published on 2010-03-19T06:55:28Z Indexed on 2010/03/19 7:01 UTC
Read the original article Hit count: 185

Filed under:
|

hey there, I'm creating a series of input elements and for some reason their values aren't $_POSTing. Any light shed on the subject would be appreciated!

My current code is as follows:

javascript

   Afields = 1;
    function addAdultInput() {
        if (Afields != 10) {
            document.getElementById('adultMembers').innerHTML += "<input type='text' value='' name='adult_members_"+Afields+"' /><br />";
            Afields += 1;
        } else {
            document.getElementById('adultMembers').innerHTML += "Only 10 Adult Member fields allowed.";
            document.getElementById('addAdultMember').disabled=true;
        }
    }

HTML

  <form name="form1" method="post" action="">
  <tr>
    <td class="style12" valign="top">Adult Members' Names:<br /><small>10 Max </small><input id="addAdultMember" type="button" onclick="addAdultInput()" name="add" value="Add Adult" /></td>
    <td id="adultMembers">
        <span class="erorr">*for paid members only</span><br />
        <input type='text' value='' name='adult_members_0' /><br />

    </td>
  </tr>
  <input type="submit" name="Submit" value="Register">
  </form>

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript